﻿using SearchInFiles.Lib.Data;
using System;
using System.Globalization;
using System.Linq;
using System.Windows.Data;

namespace SearchInFiles.Lib.Converter
{
    [ValueConversion(typeof(SearchFileType[]), typeof(string))]
    internal class FileTypesSelectInfoConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SearchFileType[] source = (SearchFileType[])value;
            return string.Join(';', source.Where(p => p.Enable).Select(p => p.TypeExtension));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
